package com.fujimana.rockincat.restree.log.log4j;

import org.apache.log4j.Level;

import com.fujimana.rockincat.restree.log.Logger;

public class Log4JLogger implements Logger {
	
	private final org.apache.log4j.Logger logger;
	
	private static final String FQCN = Log4JLogger.class.getName();
	
	Log4JLogger(String category) {
		logger = org.apache.log4j.Logger.getLogger(category);
	}
	
	@Override
	public void debug(String message) {
		logger.log(FQCN, Level.DEBUG, message, null);
	}

	@Override
	public void debug(String message, Throwable t) {
		logger.log(FQCN, Level.DEBUG, message, t);
	}

	@Override
	public void error(String message) {
		logger.log(FQCN, Level.ERROR, message, null);
	}

	@Override
	public void error(String message, Throwable t) {
		logger.log(FQCN, Level.ERROR, message, t);
	}

	@Override
	public void fatal(String message) {
		logger.log(FQCN, Level.FATAL, message, null);
	}

	@Override
	public void fatal(String message, Throwable t) {
		logger.log(FQCN, Level.FATAL, message, t);
	}

	@Override
	public void info(String message) {
		logger.log(FQCN, Level.INFO, message, null);
	}

	@Override
	public void info(String message, Throwable t) {
		logger.log(FQCN, Level.INFO, message, t);
	}

	@Override
	public boolean isDebugEnabled() {
		return logger.isEnabledFor(Level.DEBUG);
	}

	@Override
	public boolean isErrorEnabled() {
		return logger.isEnabledFor(Level.ERROR);
	}

	@Override
	public boolean isFatalEnabled() {
		return logger.isEnabledFor(Level.FATAL);
	}

	@Override
	public boolean isInfoEnabled() {
		return logger.isEnabledFor(Level.INFO);
	}

	@Override
	public boolean isTraceEnabled() {
		return logger.isEnabledFor(Level.TRACE);
	}

	@Override
	public boolean isWarnEnabled() {
		return logger.isEnabledFor(Level.WARN);
	}

	@Override
	public void trace(String message) {
		logger.log(FQCN, Level.TRACE, message, null);
	}

	@Override
	public void trace(String message, Throwable t) {
		logger.log(FQCN, Level.TRACE, message, t);
	}

	@Override
	public void warn(String message) {
		logger.log(FQCN, Level.WARN, message, null);
	}

	@Override
	public void warn(String message, Throwable t) {
		logger.log(FQCN, Level.WARN, message, t);
	}

}
